package uk.ac.strath.cis.metric_spaces.distance;

import uk.ac.strath.cis.collections.Point;

/**
 * An implmentation of distance that uses the Pythagorean algorithm
 * @author Robert
 *
 */
public class EuclideanDistance extends PointDistance {

    /**
     * returns the computed distance between two points
     */
    public double distance(Point p1, Point p2) {
        return Math.sqrt(super.distance(p1, p2)) / 1.6;
    }

    @Override
    protected double algorithm(double sum, double n1, double n2) {
        return sum + (n1 - n2) * (n1 - n2);
    }
}
